
#ifndef JSON_PRASE_RECV_H
#define JSON_PRASE_RECV_H

#include <iostream>
#include <vector>
#include <fstream>
#include <ctime>
#include "rapidjson/rapidjson.h"
#include "rapidjson/document.h"
#include "rapidjson/writer.h"
#include "rapidjson/stringbuffer.h"
#include "rapidjson/prettywriter.h"
#include "rapidjson/filereadstream.h"
#include "rapidjson/filewritestream.h"

/*
{
"VIN":"LMY1C22C00001",
"terminalID":0,
"frameID":10,
"sysDataType":1001,
"timestamp":1532345667,
"code":"01",
"data":{
    "ctrlType":10,
    "taskNo":"12345678",
    "authCode":"LMY1C22C00001",
    "ctrlStatus":"01"  //00: 无效 01：唤醒 02：点火 03：下电 04：急停
    }
}
*/
/*
{
    "VIN":"LSD1A23A10004",
    "terminalID":"02",
    "frameID":1,
    "sysDataType":1004,
    "timestamp":1701481459,
    "code":"10",
    "data":{
        "taskNo":"1730764921312624640",
        "ctrlStatus":"12"
    }
}
*/
/*
{
    "VIN":"LSD1A23A10004",
    "terminalID":"02",
    "sysDataType":1001,
    "frameId":1,
    "timeStamp":1701481507979,
    "code":"01",
    "data":{
        "authCode":"LSD1A23A10004",
        "ctrlStatus":"02",     //00: 无效  01：唤醒 02：点火 03：下电 04：急停
        "ctrlType":10,        // 10: 无效  11：车辆休眠 12：车辆唤醒
        "taskNo":"1730764921006440448"
    }
}

// 相应暂无


*/
/*
{
"VIN":"LMY1C22C00001",
"terminalID":0,
"frameID":10,
"sysDataType":1004,
"timestamp":1532345667,
"code":"01",
"data":{
        "ctrlType ":10,
        "taskNo ":”12345678”,
        "authCode ":” LMY1C22C00001”,
        "ctrlStatus ":”01” //00: 无效 01：车辆休眠 02：车辆唤醒  ， 只需要处理 ctrlStatus
    }
}
*/

// std::string jsonToString = R"(
// {"VIN":"LSD1A23A10004","terminalID":"02","sysDataType":1001,"frameId":1,"timeStamp":1701481507979,"code":"01","data":{"authCode":"LSD1A23A10004","ctrlStatus":"02","ctrlType":10,"taskNo":"1730764921006440448"}}
// )";

namespace tbox_msg
{

    class jsonPraseRecv
    {
    private:
        /* data */
    public:
        jsonPraseRecv(){};
        ~jsonPraseRecv(){};

        int parse_json(std::string content);
        int parse_json(const char *j_buf);
        void displayJson(rapidjson::Document &doc);
        rapidjson::Document string2Json(std::string str);
    };

}
#endif
